/**
*@author ymhui
*@createTime 04 16:29
*@description
*/
<template>
  <el-card class="real-card">
    <div id="real-time" class="real-div"
         :style="style">
    </div>
  </el-card>
</template>

<script>
    const eCharts = require('echarts');

    export default {
        name: "RealTime",
        computed: {},
        data() {
            return {
                style: "height: 19em"
            }
        },
        props: {
            isFullScreen: Boolean
        },
        methods: {
            createMap() {
                let myChart = eCharts.init(document.getElementById('real-time'));
                myChart.setOption(this.getOption());
            },
            getOption() {
                return {
                    title: {
                        text: '折线图堆叠',
                        textStyle: {
                            color: "#ffffff"
                        },
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    legend: {
                        textStyle: {
                            color: "#ffffff"
                        },
                        data: ['邮件营销', '联盟广告', '视频广告', '直接访问', '搜索引擎']
                    },
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    // toolbox: {
                    //     feature: {
                    //         saveAsImage: {}
                    //     }
                    // },
                    xAxis: {
                        type: 'category',
                        boundaryGap: false,
                        axisLabel: {
                            color: '#ffffff'
                        },
                        data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
                    },
                    yAxis: {
                        type: 'value',

                        splitLine: {
                            show: false
                        },

                        axisLabel: {
                            color: '#ffffff'
                        },
                    },
                    series: [
                        {
                            name: '邮件营销',
                            type: 'line',
                            stack: '总量',
                            smooth: true,
                            showSymbol: false,
                            data: [120, 132, 101, 134, 90, 230, 210]
                        },
                        {
                            name: '联盟广告',
                            type: 'line',
                            stack: '总量',
                            smooth: true,
                            showSymbol: false,
                            data: [220, 182, 191, 234, 290, 330, 310]
                        },
                        {
                            name: '视频广告',
                            type: 'line',
                            stack: '总量',
                            smooth: true,
                            showSymbol: false,
                            data: [150, 232, 201, 154, 190, 330, 410]
                        },
                        {
                            name: '直接访问',
                            type: 'line',
                            stack: '总量',
                            smooth: true,
                            showSymbol: false,
                            data: [320, 332, 301, 334, 390, 330, 320]
                        },
                        {
                            name: '搜索引擎',
                            type: 'line',
                            stack: '总量',
                            smooth: true,
                            showSymbol: false,
                            data: [820, 932, 901, 934, 1290, 1330, 1320]
                        }
                    ]
                };
            },

            wrapStyle() {
                if (this.isFullScreen) {
                    this.style = "height:23em;";
                } else {
                    this.style = "height:19em;";
                }
                this.createMap();
            }
        },
        watch: {
            isFullScreen(oldValue, newValue) {
                if (oldValue !== newValue) {
                    this.wrapStyle();
                }
            }
        },
        created() {

        },
        mounted() {
            this.createMap();
        }
    }
</script>

<style lang="scss" scoped>
  .real-card {
    background-color: transparent;
    border-width: 0;
    /*box-shadow: inset 0px 0px 20px 20px rgba(254, 253, 255, 0.1);*/
    /* 顺序为: offset-x, offset-y, blur-size, spread-size, color */
    /* blur-size 和 spread-size 是可选的 (默认为 0) */
    border-color: #03a6ff
  }

  .real-div {
    font-size: 10px;
    color: white;
  }
</style>
